<?php

namespace api\models;

use Yii;

/**
 * This is the model class for table "me_articles".
 *
 * @property integer $id
 * @property string $title
 * @property string $description
 * @property integer $cate_id
 * @property string $content
 * @property string $created_at
 * @property integer $user_id
 * @property integer $is_public
 * @property string $pv
 * @property integer $is_recommend
 * @property string $updated_at
 */
class Articles extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'user';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['title'], 'required'],
            [['cate_id', 'created_at', 'user_id', 'is_public', 'pv', 'is_recommend', 'updated_at'], 'integer'],
            [['content'], 'string'],
            [['title'], 'string', 'max' => 100],
            [['description'], 'string', 'max' => 300],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => '主键',
            'title' => '名称',
            'description' => '描述',
            'cate_id' => '分类',
            'content' => '内容',
            'created_at' => '创建时间',
            'user_id' => '用户id',
            'is_public' => '是否公开默认1公开',
            'pv' => '浏览数',
            'is_recommend' => '是否推荐',
            'updated_at' => '更新时间',
        ];
    }
    
    public function fields()
    {
        return [
            'id'=>'id',
            'title'=>'title',
            'desc'=>'description',
        ];
    }
    
    public function extraFields()
    {
        return ['category'];
    }
}
